Getting the viewport bounds in MapboxGL

This demonstration uses map.unproject() to create a geojson quadrangle for the main map's view. As you drag, zoom, pitch, and rotate the map, the polygon will update, and can be seen visualized on the inset map in blue.

map.getBounds() does not produce the same quadrangle, rather it will return the largest "north-up" rectangle that fits within the current map view. The quadrangle made from getBounds() is visualized on the inset map in red.

This approach is documented in this github issue.