Prepare a medium-sized baking dish with a light layer of oil or nonstick cooking spray.
Bring the stock to boil in a large pot over medium-high heat. When the stock boils add the polenta in a steady stream and turn heat down to low. Cook the polenta over a low heat for about 10 minutes, or until it reaches a soft and creamy consistency.
Remove the polenta from heat and beat in the margarine. Season with salt, cayenne pepper and black pepper to taste. Pour the polenta into the prepared baking dish and set in the fridge for about an hour, or until firm.
Preheat a grill to medium-high or an oven to 180°C/350°F/gas mark 4.
Remove the polenta from the fridge and place under the grill or in the oven for about 20 minutes, until it has warmed through. Remove from the grill or oven and cut into squares.
While the polenta is cooking, heat the olive oil in a large heavy-based fry pan over medium-high heat. Add the garlic and cook for 1-3 minutes, or until the garlic becomes soft and fragrant.
Add the mushrooms and cook for 3-5 minutes, or until the mushrooms are soft and beautifully brown. After 2 minutes, toss in chopped fresh rosemary and season with salt and pepper to taste.
Arrange the baked polenta squares on a large platter and top with the rosemary infused mushrooms. Decorate with sprigs of fresh rosemary.
Serve immediately while warm and fragrant.