Page coordinate arrays (page box). as well the rectangle (rect property) of form fields are in the following order (clockwise starting on the left):
Left
Top
Right
Bottom
Markup annotations like stamps also start on the left, but move counterclockwise:
Left
Bottom
Right
Top
The fact that the bottom and the top are reversed with annotations and the fact that the rect property of form fields is in rotatated user space, which the rect property of stamps is in default user space makes placing stamps programatically relative to the page box extremely complicated.
I trust the way I outline this will simplify the process for you. If you want learn JavaScript for Adobe Acrobat from the ground up, please consider supporting my work by enrolling in my online course.