Preheat oven to 220 degrees C. Grease 12 muffin cups.
In a large bowl stir together flour, sugar, salt, baking powder and rosemary until the mixture is smooth and without lumps. Lightly mix in the mozzarella cheese, Parmesan cheese, onion and garlic.
In another bowl whisk together the egg and melted butter then whisk in the milk. Make a well in the centre of the dry ingredients and pour the milk mixture into the well. Stir just to moisten, 12 to 15 full circular strokes that scrape the bottom of the bowl. The batter will look lumpy. Pour batter into the prepared muffin cups, filling them about 2/3 full.
Bake the muffins in the preheated oven until browned, about 25 minutes. Cool in pan for about 5 minutes before removing from the cups.