[Solved]Orthographic camera RECT based off points on screen

Hello everyone. I dont know whether it is too early/late(no sleep) or I am completely clueless. I cannot figure out how to fix my orthographic camera’s rect to match up to points on my main camera’s screen.
alt text

I have the screen coordinates of all of the blue points. I want to make my orthographic camera fit inside the smaller box. Anyone point me in the right direction for converting these 4 vector3 points into a rect I can use for a camera?

Explanation:

I have a UISprite in Ngui. From that sprite I am grabbing the 4 corners and converting those points to screen space using WorldToScreenPoint. I would like my orthographic camera to fit perfectly inside those 4 points.
Thanks!

First you need just two points, not four. You need the lower left point (llPoint) and the upper right point (urPoint). Second, you need them in Viewport coordinates, not screen coordinates, so you want to use WorldToViewportPoint(). Given those to points, you can do:

 Camera.main.rect = Rect(llPoint.x, llPoint.y, urPoint.x - llPoint.x, urPoint.y - llPoint.y);