1. Preheat oven to 450°F Spray a large casserole dish with nonstick spray.
2. Sauté the onions in the olive oil in skillet over medium high heat until just soft. Stir in the garlic and cook another minute, just until aromatic. Add the tomato and rosemary; continue to cook until all moisture is evaporated, about 10 minutes.
3. Layer 1/2 the sliced potatoes in the prepared casserole and season with salt and pepper. Top with 1/2 of the tomato mixture and 1/2 of the cheese. Repeat layers ending with cheese.
4. Cover and bake 30 minutes; remove foil and bake 15 minutes more to brown cheese. Let stand 5 minutes before serving so the cheese will set.