Function for rebinning in two dimensions Expected to be very slow and then re-implemented in C once it works, correctly