If you need to wrap just a few steps out of bounds (up to negative size), then you can do this like so:
(size + coordinate) % size
When coordinate = -1 then this gives you (size - 1) % size = size - 1.
And when coordinate = size then this gives you (size + size) % size = 0.
For any value in between (0 to size - 1), this behaves the same as the identity ...