protected void Init(Texture texture, Rectangle region = null, Rectangle frame = null, bool rotated = false) { if (region == null) region = new Rectangle(0.0f, 0.0f, texture.Width, texture.Height); _parent = texture; if (_frame != null) { _frame = frame.Copy(); } _transformationMatrix = Matrix.Create(); _width = rotated ? region.Height : region.Width; _height = rotated ? region.Width : region.Height; if (rotated) { _transformationMatrix.Translate(0, -1); _transformationMatrix.Rotate((float)Math.PI / 2.0f); } _transformationMatrix.Scale(region.Width / texture.Width, region.Height / texture.Height); _transformationMatrix.Translate(region.X / texture.Width, region.Top / texture.Height); }