Find the directional vector of an object and the centre of square

seriously ? it’s the same grid of chessboard square (corner)s, offset by square width / 2

well, your bot put it there, so it cant be in “any” orientation
(and, using magnetic pieces, and moving those from below, will be far easier, than with a gripper from above)

you dont need that. get the chessboard outline, the rest is maths