My comprehension of SVG, particularly the viewport, viewBox, and the user coordinate system, seemed fairly solid.
In the initial example provided below, we utilized a viewBox with a matching aspect ratio as the viewport. As expected, there was no distortion in angles due to the rotation of the user coordinate system.
In the second example, we set the viewbox to a different aspect ratio compared to the viewport. This resulted in a mismatch of shapes' aspect ratios when mapping from viewBox to viewport. Despite this scaling, the bottom-right angle remained undistorted, which is logical considering the origin of the coordinate system at (0,0).
However, in example two, when we rotated the user coordinate system, the bottom right angle became distorted. This contrasted with example one where such distortion did not occur.
Edit 1: To clarify, the concern pertains to the bottom right angle in the final example. Prior to rotation but after stretching with viewBox, the angle measured 90 degrees. After rotation, it deviated from this measure.
Why does a non-uniformly scaled triangle lose its angles upon rotating?
Example One (uniform scale)
body {
height: 500px;
}
svg {
width: 400px;
height: 400px;
border: 1px solid red;
}
<svg id="s1" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 200 200" preserveAspectRatio="none">
<style>
polygon {
transform: translate(100px, 0px);
animation: 2s ease-in 1s 1 normal forwards rotate-down;
fill: green;
}
@keyframes rotate-down {
0% {
transform: translate(100px, 0px) rotate(0deg);
}
100% {
transform: translate(100px, 0px) rotate(45deg);
}
}
</style>
<polygon points="100,100 100,0 0,100" />
</svg>
Example Two (non-uniform scale)
body {
height: 500px;
}
svg {
width: 600px;
height: 400px;
border: 1px solid red;
}
<svg id="s1" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 200 400" preserveAspectRatio="none">
<style>
polygon {
transform: translate(100px, 0px);
animation: 2s ease-in 1s 1 normal forwards rotate-down;
fill: green;
}
@keyframes rotate-down {
0% {
transform: translate(100px, 0px) rotate(0deg);
}
100% {
transform: translate(100px, 0px) rotate(45deg);
}
}
</style>
<polygon points="100,100 100,0 0,100" />
</svg>
EDIT 2 (images for clarification):
Displayed below is the triangle after adding the viewBox (thus scaling and translating), yet before any rotation. The bottom right angle measures 90 degrees.
https://i.stack.imgur.com/WlR17.png
Here is the triangle after incorporating the viewBox (scaling and translating), and after rotation. Note that the bottom right angle is no longer 90 degrees.
https://i.stack.imgur.com/diTXt.png
EDIT 3:
I have finally uncovered the root cause behind this issue.
Refer below for an explanation detailing the specifics and providing links to relevant resources.