Heat the oven to 375 F. In a large saucepan, bring water to a boil. Slowly pour in the grits, whisking briskly. Once the grits become thick and creamy, add the rosemary, thyme, salt, onion powder and garlic powder. Remove from heat; whisk in the cheese until melted and well-incorporated. Coat a 9-by-13-inch baking pan with cooking spray and add the polenta mixture. Allow mixture to set up at room temperature for 15 to 20 minutes. Cut into 12 squares and bake for 10 minutes.