Raster.matrix is translated by half the size of the raster. If not posible to fix it, might be a good idea to document it.