When x is negative, the remainder of x % 48 is also negative. You then remove the negative remainder from x, -- gives + so it actually adds the remainder and your rectangle is drawn to a multiple of 48 to the right of where it should be.
For an obvious solution, remove 48 to x when x is < 0. (do the same for y) There are probably better solutions.
int x = static_cast<int>(std::trunc(coordPos.x));
int y = static_cast<int>(std::trunc(coordPos.y));
if (x < 0) x -=48;
if (y < 0) y -=48;
x -= x % 48;
y -= y % 48;
coordPos.x = static_cast<float>(x);
coordPos.y = static_cast<float>(y);