Preheat an oven to 180 degrees C. Grease a 20x30cm baking dish.
Heat the oil in a large frypan over medium heat, and cook and stir the zucchini, squash, onion, red and green capsicums and garlic until the vegetables are tender, about 10 minutes. Add the tomatoes, pasta sauce and corn, and stir to mix. Sprinkle with chilli flakes and black pepper to taste, and bring the mixture back to a boil. Simmer for 20 minutes.
While the vegetables are simmering, fill a large pot with lightly salted water and bring to a rolling boil over high heat. Once the water is boiling, add the penne and return to a boil. Cook the pasta uncovered, stirring occasionally, until the pasta has cooked through, but is still firm to the bite, about 11 minutes. Drain well in a colander set in the sink and place the pasta in a large mixing bowl.
Add the vegetable mixture into the bowl with the cooked penne pasta, stir to mix well and spoon into the greased baking dish. Sprinkle the mozzarella cheese over the top and bake in the preheated oven until the cheese is melted and the casserole is bubbling, 20 to 30 minutes.