Allow tilegrid creation from projection or extent

The XYZ tiling convention assumes the origin is the top-left and z: 0 is a single tile covering some maximum extent.

The current `ol.tilegrid.XYZ` assumes the maximum extent is the EPSG:3857 extent.  This should be configurable - and I think it is more general to provide an extent rather than a projection.

The current `ol.tilegrid.XYZ` assumes the tile size is `ol.DEFAULT_TILE_SIZE`.  This should be configurable.

The `ol.source.XYZ` accepts a `projection` option, but generated tile grid cannot be configured with this projection's extent.
Yes, indeed.