My observations:
I tested with the VideoPreview sample and the “PTZ-Center” button in that sample, but added 5 text-boxes so that I could play with the values used. Camera was a fixed camera so testing was digital zoom.
If I made the the 5 values (100, 100, 50, 50, 60) I got dead center.
Other values seemed to work nicely too, with one special note though: If I enter something like (100, 100, 0, 50, 60) the center of the square that is zoomed to will have a center that is not the left hand side, but the left hand side of the square is left hand side of the image. This lead to, in my testing, entering (100, 100, 0, 50, 60) and (100, 100, 20, 50, 60) achieves the same result.
I do not think it is surprising behavior, you would still want the same area size of the square even when going close to the edge of the image.
(5 values ref.: PtzCenter (int refWidth, int refHeight, int centerX, int centerY, int zoom))
I have a hunch that either you find the close-to-edge behavior surprising or you might see something unexpected based on using values from mouse click or something similar, maybe you should try to focus on whether you have the right variable values when doing the PtzCenter.