Preheat the oven to 375 degrees F. Lightly mist a shallow 2-quart baking or gratin dish with cooking spray.
Thinly slice the squash, zucchini, potato, and onion 1/4-inch thick with a mandolin or by hand. Shingle the vegetables in the prepared baking dish in one layer. Season with salt and pepper. Sprinkle with the rosemary leaves and drizzle with olive oil. Cover with foil and bake until the potatoes are tender, 30 to 35 minutes.
Remove the foil; sprinkle with the cheese. Bake until the cheese is browned and most of the liquid has evaporated, about 45 minutes more. Let stand at least 10 minutes. Serve warm or at room temperature.
From Food Network Kitchens