Similar to mtext allowing adding a text to the margins of a map. This function useds the margins around the mapped area; not the margins that R would use.
f <- system.file("ex/elev.tif", package="terra")
r <- rast(f)
plot(r, axes=FALSE, legend=FALSE)
add_box()
for (i in1:4) add_mtext("margin text", i, cex=i, col=i, line=2-i)