Preheat the oven to 180 degree C. Grease a 20cm casserole dish or tart tin.
In a saucepan over a medium heat, melt the butter then add the onions and cook and stir until soft. Add the spinach and cook until just wilted. Tip in the rice, mix well and set aside.
In a large bowl, whisk together the milk and eggs then add the cheese along with the rice mixture and mix well. Season to taste. Transfer the mixture to the prepared casserole dish or tart tin then sprinkle with cheese.
Bake in the preheated oven for 20 minutes or until the cheese is bubbling on top. Remove from the oven and leave to stand for 5 minutes. Slice into squares and serve immediately.