Find Altitude based on Rectangle

Given a rectangle, I need to find what the altitude would the camera would be if the camera view was set to this rectangle.

I have to do this without setting the view of the camera.

Any thoughts on how to approach this problem?

My first thought would be to look at what the setView function does, and how it computes what the camera position/altitude should be:

I think you can either extract the math you need from there, or set the camera transform, copy the height, and set it back all in one frame. Although for that to work you might need to manually call render on scene, which is kind of a hack.

What are you trying to do that requires knowledge of the camera altitude ahead of time?