A: 

If you want it to be left units from the left and top units from the top, then try the origin as:

x: left
y: window.frame.size.height - rectangle.frame.size.height - top

Ben Alpert
But ... I don't know what top is after the window resizes. That's the unknown quantity. Or am I missing something here? I can position the rectangle before the move as 546 + 84 (origin is in the top left), but after the window resizes, I only have the new height as 717. The new origin should be 717 + x, but I don't what to set x as to keep it the same relative distance from the top as before. (I measured it as 99, but I don't know how to calculate that value from what I have.)
Winawer
Didn't you want to keep the distance from the top constant?
Ben Alpert
The margins are constant, but the distance from the top isn't because of the window resize. I don't know how to explain it better than this, which is probably part of the problem. In Interface Builder, it looks like this in the autoresizing controls: http://img221.imageshack.us/img221/7292/ibexample.png, though I'm only concerned about the top and left. Note how the margins remain the same even though the window resizes; if this were my own app, Cocoa would do that for me, but I'm faced with having to calculate this myself now, and I'm having trouble.
Winawer
So you want constant height, proportionally growing top and bottom margins, and constant left and right margins?
Ben Alpert
The rectangle has to remain in the same position relative to the top and left, so the margins (expressed in pixels from the top and left) have to change to keep it there, e.g. if it were in the center, the top and left have to change so that the rectangle stays in the center. I was calling them "constant" because I was thinking visually, but you're right in that the margins are actually growing / shrinking as the window resizes. (The bottom and right aren't important for this problem - the window has a minimum and maximum size).
Winawer
In other words: I need to know what distance (in pixels) to set the top of the rectangle from the top / left of the window in order to correctly set the margins to keep the rectangle in proportionally the same place, as in the IB example diagram.
Winawer
A: 

For posterity: I really have no idea how Apple (or anyone else) does this - and honestly, I think the application I'm trying to interact with was not written with this in mind anyways, since it is far from accessible. To solve the problem, I just ended up sampling a whole bunch of different (x,y) pairs and constructing a linear model to predict the right coordinates for arbitrary coordinates. A little bit of a sledgehammer, but it's the best I could come up with.

Winawer