Base: How can I display an image in a RectangleShape object?

You can add a picture to a form using com.sun.star.drawing.GraphicObjectShape, but the picture will fill the whole area, and I want to be able to display square images centered in a 16:9 rectangle.

com.sun.star.drawing.RectangleShape seems to be able to do it, but when I set its FillBitmap property, no image is shown. Here is the full code:

oGraphicsShape=ThisComponent.createInstance("com.sun.star.drawing.RectangleShape")
aSize=CreateUnoStruct("com.sun.star.awt.Size")
ratio=50706/1917
aSize.Width=222*ratio
aSize.Height=125*ratio
oGraphicsShape.setSize(aSize)

aPoint=CreateUnoStruct("com.sun.star.awt.Point")
aPoint.X=0
aPoint.Y=0
oGraphicsShape.setPosition(aPoint)

oGraphicsShape.FillStyle=com.sun.star.drawing.FillStyle.BITMAP

oGraphicsShape.FillBitmapLogicalSize=true
oGraphicsShape.FillBitmapSizeX=100
oGraphicsShape.FillBitmapSizeY=100

url="file:///C:/Users/fodor/OneDrive/Documents/Recipe%20organizer/Developing-own/testimage222x125.jpg"

oProvider=createUnoService("com.sun.star.graphic.GraphicProvider")
Dim args(0) as new com.sun.star.beans.PropertyValue
args(0).Name = "URL"
args(0).Value = url
oGraphicsShape.FillBitmap = oProvider.queryGraphic(args())

oGraphicsShape.AnchorType=com.sun.star.text.TextContentAnchorType.AT_PAGE
ThisComponent.DrawPage.add(oGraphicsShape)

'-------------------------------

oGraphicsShape=ThisComponent.createInstance("com.sun.star.drawing.GraphicObjectShape")	

oGraphicsShape.setSize(aSize)
aPoint.Y=125 * ratio
oGraphicsShape.setPosition(aPoint)	

oGraphicsShape.Graphic = oProvider.queryGraphic(args())

oGraphicsShape.AnchorType=com.sun.star.text.TextContentAnchorType.AT_PAGE
ThisComponent.DrawPage.add(oGraphicsShape)

On the top left corner of the page a blue rectangle is displayed, while below the actual picture.