Place an oven rack in the upper third of the oven and preheat to 400 degrees F.
Combine the shallots, garlic, 2 tablespoons olive oil and 1 teaspoon thyme in a baking dish. Bake, stirring halfway through, until lightly caramelized, 15 to 20 minutes. Let cool.
Line 2 baking sheets with cooling racks. Divide the eggplant, yellow squash and zucchini between the 2 sheets. Season the vegetables with 1 1/2 teaspoons salt. Let stand 30 minutes.
Firmly press the vegetables with a kitchen towel to remove excess water. Lift the racks from the baking sheets and brush off any excess water and salt. Transfer the vegetables onto the sheet trays. Add the tomatoes to one of the sheet trays. Toss each type of vegetable with 1 tablespoon olive oil, 1 teaspoon thyme and salt and pepper to taste.
Make one stack of vegetables on a baking sheet. Start with 1 tomato slice, top it with 1 to 2 slices of zucchini, depending on the size, 1 to 2 slices of yellow squash, and then top with 1 slice of eggplant. (The zucchini and yellow squash slices should fill the same amount of space as the tomato and eggplant; if they are smaller slices, use two.) Place the stack on its side in the baking dish, on top of the caramelized shallots. Repeat making stacks and adding them into the baking dish in a spiral, working from the outside inward. If there are extra vegetables, add them to the center of the dish at the end. Sprinkle with the fontina and Parmesan. Bake until the vegetables are tender and the cheese is melted and golden brown, 35 minutes. Let cool 15 minutes.
Garnish with the basil and serve with crusty bread.