This is pretty messy, but I threw it together anyway.
draw.rect <- function(x1=0.9,y1=0.1,x2=0.8,y2=0.3,width=0.05){
ang <- atan((y2-y1)/(x2-x1))
xshift <- width*sin(ang)
yshift <- width*cos(ang)
polygon(x=c(x1,x2,x2-xshift,x1-xshift),y=c(y1,y2,y2+yshift,y1+yshift),col="pink")
}
It would allow you to use your same coordinates. You can adjust the size of the rectangle with the width argument. I think @VincentZoonekynd has a great idea with drawing the segment twice. This rough function does not center the rectangle on the coordinates provided, although you could pretty easily adjust it to do so.