Dug around other similar topics and found a solution, posting it here in case anyone has a similar problem to mine. The solution is in this thread
It seems this is a 'problem' with high DPI displays in particular. I changed the way the program gets the X and Y coordinates from the mouse by taking into account the devicePixelRatio() as outlined in the linked thread, which solved the offsetting.