private Rect ResizeRectToFit(Rect rect, Rect to)
{
float a = to.width / rect.width;
float b = to.height / rect.height;
float num3 = Mathf.Min(a, b);
float width = (int) Mathf.Round(rect.width * num3);
return new Rect(rect.x, rect.y, width, (int) Mathf.Round(rect.height * num3));
}