The quantum query complexity of implementing black-box unitary transformations