private Rectangle GetRegionAtLocation(Vector2 pointInMap) { var top = (int)Cells.GetPointsInLine(pointInMap, Direction.Up).First(p => p.Value == ImageCellType.MapBoundary).Position.Y; var left = (int)Cells.GetPointsInLine(pointInMap, Direction.Left).First(p => p.Value == ImageCellType.MapBoundary).Position.X; var bottom = (int)Cells.GetPointsInLine(pointInMap, Direction.Down).First(p => p.Value == ImageCellType.MapBoundary).Position.Y; var right = (int)Cells.GetPointsInLine(pointInMap, Direction.Right).First(p => p.Value == ImageCellType.MapBoundary).Position.X; left++; top++; return(new Rectangle(left, top, right - left, bottom - top)); }