I would like to clarify one thing that I think was not very clear in my question: the vectors used to create the grid should contain in principle the x and y coordinates of the centres of each bin. They could also be the coordinates of the vertices of the bins instead, if necessary.
Thanks again.