@Gravity, from the comments in the original problem, you indicate this is a perfect square part with one corner resting on the horizontal plane of Z reference.
Using the calculation that follows, we come up with two-equations and two-unknowns, which we then solve. (At the time, the X and Y locations of the the corners relative to the ground were unknown.)
Imagine a perfect circle canted at an angle, reletive to the ground's vertical, and a perfect square randomly placed on the circle such that the four corners, of the square, lie on the periphery of the circle. This is what you have (the circle is imaginary and for calculation purposes). The two diagonals of the square both represent the DIAMETER of the imaginary circle. The DIAMETER will be used at the end (along with the calculated HEIGHT) to calculate the CantedAngleOfTheCircle (the flagpole normal of the square off of the ground's vertical in degrees).
I am trying to solve this in terms that you know (or can measure), since you don't know the X, and Y locations of each corner (reletive to the ground's plane of reference), just the Z locations (reletive to the ground's plane of reference).
What I visualize is:
The elevation difference between the highest point and the lowest points of the imaginary circle is one variable, $HEIGHT$.
The other variable is the $ANGLE$ between two lines (described below), $$( 0º < ANGLE < 90º )$$ The line between the two opposite corners of the square with the largest height difference and the line between the highest and lowest points of the imaginar circle (as measured in the plane of your square part).
Let’s call the shortest elevation difference across one diagonal of the square $MIN$. And let’s call the longest elevation difference across the other diagonal $MAX$. Both $MIN$ and $MAX$ are known numerical values.
Since we are referencing $ANGLE$ relative to the largest elevation difference, $MAX$, I will use the cosine in my function.
Angles are measured in degrees.
$$MAX = HEIGHT · COS ( ANGLE )$$
$$MIN = HEIGHT · COS ( 90 + ANGLE )$$
Let’s solve the second equation for $HEIGHT$ and place it into the first equation and then the first equation becomes,
$$MAX = MIN · COS ( ANGLE ) / COS ( 90 + ANGLE )$$
Then we'll solve for $ANGLE$.
Since $SIN ( 90 + ANGLE ) = COS ( ANGLE )$ we can say,
$MAX = MIN · TAN ( 90 + ANGLE )$
Thus $ANGLE = ARCTAN ( MAX / MIN ) - 90$
Let’s set $MIN$ as $10-mm$ and $MAX$ as $15-mm$.
Then $ANGLE = -33.7º$ and $HEIGHT = 18.0-mm$.
Finally (to answer your original question), use the value $HEIGHT = DIAMETER \cdot SIN(CantedAngleOfTheCircle)$ in order to calculate the circle's normal angle relative to the vertical. Do this by using,$$CantedAngleOfTheCircle = ASIN (HEIGHT / DIAMETER )$$
Use the values you know (DIAMETER (from the hypotenuse of the square)) or have measured (MIN, MAX) and see if this algorythm provides an answer that solves your concern.