The hidden subgroup problem for generalized quaternions