In a large skillet over medium heat, warm the oil. Add the garlic and rosemary (if using) and cook, stirring often, for 1 minute.
Add the spinach and ½ teaspoon salt and cook until most of the water evaporates, stirring occasionally, about 3-4 minutes.
Add beans and remaining 1 teaspoon salt and use a fork to mash most of them up into a paste. Stir everything together, then transfer to a bowl and carefully wipe out the skillet.
Lay your tortillas out and spread ¼ of the bean mixture onto ½ of each tortilla. Top with apple slices and press them down gently so they stick and submerge a little into the beans. Sprinkle ½ cup of cheese over the apples in an even layer. Fold the tortilla over the top to form a semicircle.
Heat the skillet over medium-high. Once hot, add the tortilla to the pan. Cook for 2-3 minutes, or until golden brown, then carefully flip and repeat on the other side.
Slice the quesadilla and serve with yogurt or sour cream.