Lightly spray a baking dish with oil (mine measured around 8 x 8 inches, but it was a tight fit!), then layer up the tomato pasta, the cooked aubergine slices, the three cheeses, and the basil pesto. The exact order of the layers doesn't matter, but this is the order I used:
1/3 of the aubergine slices;Smear of basil pesto;
1/3 of the pasta;
1/2 the mozzarella;
1/3 of the cheddar;
1/2 the parmesan
I repeated this sequence twice, then finished with the remaining pasta, aubergine slices, and cheddar cheese.