Lets say i have created a rectangle using
h(i) = imrect(gca, [1,1,4,4]);
and then i add a text object with the rectangles name or some data
text(1,1,num2str(1),'BackgroundColor',[.7 .9 .7],'FontSize',7);
How can i make the text follow the rectangle at its final position after i move it?