Receive in the liquid template only those products that will be rendered

I’m creating an embed extension. For the extension to work successfully, you need to get products that are displayed at xxx.myshopify.com/collections/all, taking into account pagination.
Sections/main-collection-product-grid.liquid - does it like this

{%- paginate collection.products by section.settings.products_per_page -%}

Since I’m making an embed extension I don’t have access to section (section.settings.products_per_page)
this value is stored in templates.collection.json



how can I get this parameter? Or is there another way to get these products?
My code:

{%- if collection.products.size != 0 -%}
{%- paginate collection.products by $there should be a parameter here$ -%}
{% assign jsonObjects = "" %}
{% for product in collection.products %}

...

{% endfor %}
{%- endpaginate -%}
{%- endif -%}

{% schema %}
{
"name": "Collection product",
"target": "body",
"settings": []
}
{% endschema %}