I've found this answer which explains how to arrange a collection of rectangles inside a grid in XAML:
<Grid... >
<Rectangle Grid.Column="0"
Grid.Row="0"
Stroke="Blue"
Fill="Transparent" />
<TextBlock Grid.Column="0"
Grid.Row="0"
Text="(0,0)" />
</Rectangle>
...
</Grid>
Now I'm trying to do the same in C#, and I've found out that Rectangle doesn't have a Content property. So how do I add a TextBlock to a Rectangle?