Detect rectangle collision