A novel technique for searching for complex patterns in large multimedia databases is presented, based on rotation independent template matching. To handle objects of arbitrary shape while reducing the computational workload, the pattern to be localized is partitioned into small square blocks of sizes adapted to the local image content using quadtree decomposition. The use of Zernike polynomials for representing each block allows the design of a fast and effective maximum likelihood matching procedure to sequentially verify whether the target image contains each block of the quadtree. State of the art methods usually represent the whole pattern by using an orthogonal basis and extracting an invariant feature vector from the representation coefficients. In the proposed scheme, the use of the quadtree decomposition allows us to bind the number of terms of the truncated expansions, still guaranteeing a precise image representation.