Ray-aware rectangle intersection check.