Initial and untested quadtree implementation

Needs a lot of situation-specific and performance-related testing.