When I convert a 612x792 PDF page to image using the following settings, I get the expected DPI of 94.
This is because the image source width, height are flipped (due to rotation) but the hres, vres parameters are not.
So assuming your input.pdf is portrait orientated (taller than wider), and you specify portrait output (again taller than wider), then when calculating the scale/dpi, the width and height of the source are swapped, so the pdf is landscaped orientation, but the target is portrait, so it gets scaled smaller.
To keep the aspect ratio the smallest scale adjustment is picked. Which in this case is
while the non-rotated is
You might want to do image rotation after the generating the image, as that is a trivial process for an image manipulation tool. Or switch your hres, vres values when rotating by 90 or 270 degrees.