private static void DrawImageLayer(SpriteBatch spriteBatch, float z, Layer layer) { ImageLayer imageLayer = layer as ImageLayer; Rectangle worldRect = new Rectangle((int)imageLayer.HorizontalOffset, (int)imageLayer.VerticalOffset, imageLayer.Width(), imageLayer.Height()); Rectangle screenRect = Camera.WorldToScreen(worldRect); Rectangle sourceRect = new Rectangle(0, 0, imageLayer.Width(), imageLayer.Height()); spriteBatch.Draw(imageLayer.Image, screenRect, sourceRect, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, z); }