Draw a 2d box using Bgl in viewport
It's a quadrilateral, you need to define 4 verts.

Test method, x and y are pixel coordinates of bottom left corner of rectangle, h and w the height and width (in pixels) respectively. 

def draw_box(self, x, y, w, h, color=(0.0, 0.0, 0.0, 1.0)):
    #bgl.glDepthRange (0.1, 1.0)
    bgl.glColor4f(*color)
    bgl.glBegin(bgl.GL_QUADS)

    bgl.glVertex2f(x + w, y + h)
    bgl.glVertex2f(x, y + h)
    bgl.glVertex2f(x, y)
    bgl.glVertex2f(x + w, y)
    bgl.glEnd()


Run-able Example