Fix rect intersection, add test