What is the size of the rectangle? What is the height of the text style? Are those properties consistent? Where can the text be placed in the rectangle: in a column, in a row, at the corners, along the edges? Could you make it all into a block with attributes and arrange it once instead of using a function?
Welcome to the forum.