Fix dx/dy range check (they can be negative and still be in-range)