Use a common function for rendering tiles