A gas pixel detector for X-ray polarimetry