public static Matrix3x3 GetShaderProjectionMatrix(this TextureRegion2D source) { var bounds = source.Bounds; float sx = bounds.Width * 1f / source.Texture.Width; float sy = bounds.Height * 1f / source.Texture.Height; float px = bounds.X * 1f / source.Texture.Width; float py = bounds.Y * 1f / source.Texture.Height; return(Matrix3x3.CreateScaleTranslation(px, py, sx, sy)); }