WMTS with small rectangle

Hello
I’m trying to display a WMTS layer in Cesium

My provider looks like:

new WebMapTileServiceImageryProvider({

url : url,

layer : ‘<layer_name>’,

style : ‘default’,

format : ‘image/jpeg’,

tileMatrixSetID : ‘EPSG:4326’,

maximumLevel: 6,

rectangle: Rectangle.fromDegrees(-117.2936752645782, 32.66974524643059, -117.172822594526, 32.84103990369341)

});

But nothing is working, I mostly get bad requests going out with out of range tileRow and/or tileCol

I’ve also tried setting the GeographicTilingScheme but that isn’t working either.

E.g.

new GeographicTilingScheme({

rectangle: Rectangle.fromDegrees(-117.2936752645782, 32.66974524643059, -117.172822594526, 32.84103990369341),

numberOfLevelZeroTilesX: 1,

numberOfLevelZeroTilesY: 2

})

Do you have any suggestions on how to get this to work?

Also to be clear, the rectangle is the extent of the layer from the capabilities document.
So it’s not that I’m trying to display a small rectangle of a larger layer but the whole layer fits into a small rectangle with maximumLevel == 6.

I was able to get some better results by using the tileMatrixLabels option to map the requested level to the appropriate tileMatrix(essentially reverse the Z) but I still saw a bunch of bad tile requests going out which I’m assuming is because the number of rows/cols advertised in the capabilities document does not correspond to the number you would get from a quad-tree.
Is there a way to work around this? The situation where the available tiles for a level are not equal to tiles in a quad-tree? Or maybe it is something else entirely…

Also, the bounding box for my wmts layer is the bounding box for the map data, however the map data does not fill the entire returned 256x256 tile(s) at the requested level. However Cesium assumes it does and fills the rectangle/tile with returned 256x256 tile so the map is actually is distorted. Any suggestions on how to work around this? The same map requested via WMS does render just fine.

Also, this map works with both WMS/WMTS in ol3 so I just tried the latest version of ol3-cesium for these maps but it didn’t work for either in ‘3d’

Any suggestions anyone has would be apprecitated.