For mapping your robot onto some space, what you have is the centroid of the object and it's orientation. Imagine the robot is a box, you have the (x,y) point of it's centroid, as well as which direction the robot is facing. As for the obstacle, I assume you know the orientation of the IR sensor?
The rotation matrix you pasted in the question is good for getting the coordinates of the box around the centroid. To graph an arbitary patch you can do the following:
function [handle] = drawBox(x, y, theta)
x0_coord = [-width / 2, width / 2, width / 2, -width / 2];
y0_coord = [-height / 2, -height / 2, height / 2, height / 2];
rotation = [cos(theta), -sin(theta); sin(theta), cos(theta)];
to_shift(:,i) = rotation * [x0_coord(i); y0_coord(i)];
shifted_coord = [x; y] + to_shift;
'Vertices', [shifted_coord(1,:); shifted_coord(2,:)]', 'Faces', [1 2 3 4],...
'FaceColor','k','EdgeColor','k','LineWidth',2);