Coat a large (3-quart) glass baking dish with olive oil.
Spread the potatoes over the bottom in an even layer. Sprinkle garlic and 1/2 of thyme leaves over the top; drizzle with oil and season lightly with salt and pepper.
Spread 1/2 of onion slices, separated into rings over potatoes; sprinkle 1/2 of the grated pecorino cheese; drizzle with oil and season lightly with salt and pepper.
Arrange red pepper and tomato slices in an even layer over the onion, drizzle with oil, sprinkle with remaining thyme leaves and season lightly with salt and pepper.
Arrange remaining onion slices, separated into rings over the tomatoes.
Top onion with zucchini and yellow squash in an even layer; drizzle with oil and season lightly with salt and pepper. Sprinkle with remaining cheese.
Cover the dish with foil and bake for 1 hour.
Increase the oven temperature to 400°F. Uncover the casserole and bake for about 15 minutes longer, until the vegetables are tender and lightly brown on top. Let stand 10 minutes and serve warm.