This seems to me like a fairly simple problem but I'm constantly re-thinking it because something seems wrong about how I'm solving it. I feel like there may be perhaps an easier solution or something I missed which would invalidate mine
The problem is: Say we have a arbitrary rectangle in an euclidean 2D plane for whose 4 vertices we know the coordinates. The angle for this rectangle is measured always as the angle between a horizontal plane (x-axis, which it is always above) and the side which would be parallel to the horizontal plane first if the rectangle were to be rotated counter-clockwise. We have to instead figure out the absolute value of the angle of the offset between the bottom line of the rectangle and the beginning of the unit circle. We're always given the angle between the side that would touch be parallel to the horizontal line if the rectangle was rotated counter-clockwise, as explained above.
We need to figure out this angle for any arbitrary rectangle. And to clarify this is in code, so eyeballing it and using tools is out of the question.
Currently I'm solving it very simply by taking the x coordinate of the bottom-most point. and checking it against the x coordinates of the left-most and right-most point. Based on which one is closer, the answer is either just simply the given angle, or 90 subtracted by the given angle.
I am not sure if this solution works globally and I'm not sure how to prove it, or if there's a better one.
In the example above, Alpha is always given (the angle between the side that would be parallel to x-axis first if rotated counter-clockwise), and Beta is the required solution. In the left example, we need to subtract Alpha from 90 to get the solution, in the right example, alpha is already equal to the correct solution.

The method you are using may not always work.
Consider points $(x_n, y_n), 1 \leq n \leq 4$ anti-clockwise. Say $(x_1, y_1)$ is the vertex with least $y$ value. Now there will be two adjacent sides that contain this vertex - one is the length of the rectangle and the other is the width (length > width). If you always want to find the absolute angle of the side which is length, with the horizontal axis, your method may not work when, for example, the rectangle is almost vertical [note $x_4$ is min($x$) and $x_2$ is max ($x$)]. You may have $|x_2 - x_1| \leq |x_4 - x_1|$ but the angle you want is $(90^0 - \alpha)$ and not $\alpha$.
Here is what I suggest -
First find vertex with min($y$), say it is $(x_i, y_i)$. Now find vertices which has min ($x$) and max ($x$) of the remaining three vertices. Say they are $(x_j, y_j)$ and $(x_k, y_k)$ respectively.
You are already given absolute angle of line segment from $(x_i, y_i)$ to $(x_j, y_j)$, with the horizontal axis.
Next find $d_{ij} = \sqrt{(x_j - x_i)^2 + (y_j - y_i)^2}$ and $d_{ik} = \sqrt{(x_k - x_i)^2 + (y_k - y_i)^2}$. If $|d_{ij}| \gt |d_{ik}|$, the angle you want is the given angle $\alpha$. If $|d_{ij}| \lt |d_{ik}|$, the angle you want is $(90^0 - \alpha)$. If $|d_{ij}| = |d_{ik}|, $ you do not have a rectangle (instead it is a square).