Update the resampling function to be able to use a 2D grid of positions instead of a number of positions in x and y. The change is not very elegant, but it does the job. This is still slow as hell.