I have implemented a simple solution that seems to be working for myself. I solved it by ensuring that my shader takes in both colour and texture coordinate data. The other requirement is that you set the colour of all textured vertices to black. My fragment shader is then set up as follows:
#version 330 core
out vec4 gl_FragColor;
in vec2 ...
b is the size of the box, measured from the center to one corner - what we often call the "half-extents" of the shape.
So a box 10 units wide and 2 units tall would use b = vec2(5, 1)
To draw a 2x2 square, you'd want b = vec2(1, 1)