Preheat oven to 350 degrees F. Butter a large casserole dish.
In a large pan over medium-high heat, saute onions with 2 tablespoons of butter and cayenne until translucent. Add the spinach and cook for 3 minutes. Set aside.
In a large bowl, whisk together milk and eggs.
Add the cheese, rice, parsley, thyme, basil and spinach mixture and combine well. Season with salt and pepper.
Pour into prepared casserole dish and top with extra shredded cheese. Bake for 30 minutes and serve piping hot.