How to Make It
Preheat the oven to 400°. Position 1 rack in the middle of the oven and 1 in the lower third. Put the onions on a rimmed baking sheet, drizzle with 2 tablespoons of the olive oil and season with salt and pepper. Put the shallots in a large roasting pan and drizzle with 2 tablespoons of the oil. Season with salt and pepper. Roast the onions and shallots for about 50 minutes, tossing occasionally, until soft and lightly browned. Let the shallots cool slightly, then peel them. Pour any juices from the onions and shallots into a bowl and reserve. Return the shallots to the roasting pan and add the onions.
Place the tomatoes, cut side down, on a large rimmed baking sheet. Drizzle with the remaining 2 tablespoons olive oil and the balsamic vinegar and season with salt and pepper. Roast the tomatoes for 40 minutes, or until their skins are wrinkled and lightly browned. Let cool slightly, then remove the skins.
Pour any accumulated tomato juices into the bowl with the reserved onion juices and save for making the sauce. Add the tomatoes to the roasting pan and toss the vegetables. Cover loosely with foil and keep warm. Garnish with rosemary before serving.